/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.mwas.proteana.file.readers;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author loskov
 */
public class ProteanaFileReader {
    
    protected File file;
    protected String path;
    protected ArrayList<String> output = null;
    
    public ProteanaFileReader(String path) {
        this.path = path;
        this.file = new File(path);
        output = new ArrayList<>();
        readFile();
    }

    public ProteanaFileReader(File file) {
        this.path = file.getPath();
        this.file = file;
        output = new ArrayList<>();
        readFile();
    }
    
    private void readFile() {
        FileReader fr;
        try {
            fr = new FileReader(file);
            BufferedReader br = new BufferedReader(fr);
            String line;
            while ((line = br.readLine()) != null) {
                output.add(line);
            }
        } catch (FileNotFoundException ex) {
            Logger.getLogger(ProteanaFileReader.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(ProteanaFileReader.class.getName()).log(Level.SEVERE, null, ex);
        }
    };

    public ArrayList<String> getOutput() {
        return output;
    }
    
}
